package com.zkt.oss.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 赵开泰
 * @program jc-club
 * @date 2025/3/16 22:18
 * @description minio配置类
 **/

@Configuration
public class MinioConfig {
	
	/**
	 * minioUrl
	 */
	@Value("${minio.url}")
	private String url;
	
	/**
	 * minio账户
	 */
	@Value("${minio.accessKey}")
	private String accessKey;
	
	/**
	 * minio密码
	 */
	@Value("${minio.secretKey}")
	private String secretKey;
	
	/**
	 * 构造minioClient
	 *
	 * @return minioClientBean
	 */
	@Bean
	public MinioClient getMinioClient() {
		return MinioClient.builder()
				.endpoint(url)
				.credentials(accessKey, secretKey)
				.build();
	}
}